﻿<UserControl x:Class="WpfChess.WpfPresentation.View.FigureView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Figures="clr-namespace:WpfChess.ChessModel.Figures;assembly=WpfChess.ChessModel"
             xmlns:Converters="clr-namespace:WpfChess.WpfPresentation.Converters"
             xmlns:Figures1="clr-namespace:WpfChess.ChessModel.Figures;assembly=WpfChess.ChessModel" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <Converters:IsWhiteToFillColorConverter x:Key="isWhiteToFillColorConverter" />
        <Converters:IsWhiteToStrokeColorConverter x:Key="isWhiteToStrokeColorConverter" />
        
        <DataTemplate DataType="{x:Type Figures1:PawnFigure}">
            <Viewbox>
                <Canvas Height="80" Width="80">
                    <Path Stroke="{Binding Path=IsWhite, Converter={StaticResource ResourceKey=isWhiteToStrokeColorConverter}}" StrokeThickness="2" Stretch="Fill" Fill="{Binding Path=IsWhite, Converter={StaticResource ResourceKey=isWhiteToFillColorConverter}}" Data="M80,89 L20,89 Q20,69 43,55 C30,48 30,35 43,28 A11,11,0,1,1,57,28 C70,35 70,48 57,55 Q80,69 80,89 z" Height="70" Width="70" Margin="5,10,0,0"></Path>
                </Canvas>
            </Viewbox>
        </DataTemplate>

        <DataTemplate DataType="{x:Type Figures:RookFigure}">
            <Viewbox>
                <Canvas Height="80" Width="80">
                    <Path Stroke="{Binding Path=IsWhite, Converter={StaticResource ResourceKey=isWhiteToStrokeColorConverter}}" StrokeThickness="2" Stretch="Fill" Fill="{Binding Path=IsWhite, Converter={StaticResource ResourceKey=isWhiteToFillColorConverter}}" Data="M86,99 L14,99 Q14,83 22,82 Q50,80 78,82 Q86,83 86,99 z M78,74 Q50,72 22,74 L27,44 Q50,42 73,44 L78,74 z M73,35 Q50,33 27,35 Q19,28 19,23 L18,9 A47,19,0,0,0,29,7 L33,20 L40,20 L44,5 A47,19,0,0,0,56,5 L60,20 L67,20 L71,7 A47,19,0,0,0,82,9 L81,23 Q81,28 73,35 z" Height="80" Width="80"></Path>
                </Canvas>
            </Viewbox>
        </DataTemplate>
        
        <DataTemplate DataType="{x:Type Figures:KnightFigure}">
            <Viewbox>
                <Canvas Height="80" Width="80">
                    <Path Stroke="{Binding Path=IsWhite, Converter={StaticResource ResourceKey=isWhiteToStrokeColorConverter}}" StrokeThickness="2" Stretch="Fill" Fill="{Binding Path=IsWhite, Converter={StaticResource ResourceKey=isWhiteToFillColorConverter}}" Data="M82,99 L10,99 Q10,83 18,82 Q46,80 74,82 Q82,83 82,99 z M74,74 Q46,72 18,74 Q16,75 16,70 Q17,25 45,16 Q50,16 54,13 L62,4 Q66,0 67,5 Q68,13 75,19 Q78,22 78,28 Q81,34 84,38 Q93,47 93,55 C93,60 85,67 80,60 Q78,56 72,54 Q63,52 56,46 Q54,42 52,45 Q50,53 56,58 Q60,62 66,65 Q73,68 76,72 Q79,75 74,74 z" Height="80" Width="80">
                    </Path>
                </Canvas>
            </Viewbox>
        </DataTemplate>

        <DataTemplate DataType="{x:Type Figures:BishopFigure}">
            <Viewbox>
                <Canvas Height="80" Width="80">
                    <Path Stroke="{Binding Path=IsWhite, Converter={StaticResource ResourceKey=isWhiteToStrokeColorConverter}}" StrokeThickness="2" Stretch="Fill" Fill="{Binding Path=IsWhite, Converter={StaticResource ResourceKey=isWhiteToFillColorConverter}}" Data="M50,90 C45,91 45,97 40,98 L5,98 L1,81 L28,81 C29,80 29,75 30,74 L70,74 C71,75 71,80 72,81 L99,81 L95,98 L60,98 C55,97 55,91 50,90 z M70,67 L30,67 C16,65 26,28 40,21 Q48,30 48,44 L54,44 Q54,30 46,21 C42,15 44,3 52,2 C60,3 58,12 57,17 L60,21 C74,28 84,65 70,67 z" Height="80" Width="80"></Path>
                </Canvas>
            </Viewbox>
        </DataTemplate>

        <DataTemplate DataType="{x:Type Figures:QueenFigure}">
            <Viewbox>
                <Canvas Height="80" Width="80">
                    <Path Stroke="{Binding Path=IsWhite, Converter={StaticResource ResourceKey=isWhiteToStrokeColorConverter}}" StrokeThickness="2" Stretch="Fill" Fill="{Binding Path=IsWhite, Converter={StaticResource ResourceKey=isWhiteToFillColorConverter}}" Data="M86,99 L14,99 Q14,83 22,82 Q50,80 78,82 Q86,83 86,99 z M78,74 Q50,72 22,74 L8,37 A9,9,0,1,1,16,35 L28,49 L33,24 A9,9,0,1,1,42,23 L50,47 L58,23 A9,9,0,1,1,67,24 L72,49 L84,35 A9,9,0,1,1,92,37 L78,74 z" Height="80" Width="80">
                    </Path>
                </Canvas>
            </Viewbox>
        </DataTemplate>

        <DataTemplate DataType="{x:Type Figures:KingFigure}">
            <Viewbox>
                <Canvas Height="80" Width="80">
                    <Path Stroke="{Binding Path=IsWhite, Converter={StaticResource ResourceKey=isWhiteToStrokeColorConverter}}" StrokeThickness="2" Stretch="Fill" Fill="{Binding Path=IsWhite, Converter={StaticResource ResourceKey=isWhiteToFillColorConverter}}" Data="M86,99 L14,99 Q14,83 22,82 Q50,80 78,82 Q86,83 86,99 z M78,74 Q50,72 22,74 Q18,72 20,67 Q22,63 16,56 Q4,43 11,28 Q21,16 38,23 Q46,28 50,38 Q54,28 62,23 Q79,16 89,28 Q96,43 84,56 Q78,63 80,67 Q82,72 78,74 z M42,10 L50,34 L58,10 A8,8,0,1,0,42,10 z M41,58 C41,63 37,63 37,58 L33,49 C28,43 34,39 37,45 L41,58 z M59,58 C59,63 63,63 63,58 L67,49 C72,43 66,39 63,45 L59,58 z" Height="80" Width="80"></Path>
                </Canvas>
            </Viewbox>
        </DataTemplate>
    </UserControl.Resources>
    <Grid>
        <ContentControl Content="{Binding Mode=OneWay}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
    </Grid>
</UserControl>
